<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>框分类信息系统 后台管理</title>
    <link href="__PUBLIC__/Admin/css/addadvert.css" rel="stylesheet" type="text/css" />
    <style>
        .imgdetail{ 
            display:none;
        }

    </style>
    <script>
    </script>

</head>

<body>
    
    <form id="adEdit" name="adEdit" method="post" action="__SELF__">
        <div align="center">
            <div class="main" align="left">

                <script type="text/javascript" language="javascript" src="__PUBLIC__/Admin/js/addadvert.js"></script>
                <script type="text/javascript" language="javascript" src="__PUBLIC__/Admin/js/jquery-1.8.3.min.js"></script>
                <div class="top" id="top">



                </div>
                <script type="text/javascript">
                  /*  var objNav = [{
                        mUrl: "/index.aspx",
                        sNavName: ["网站设置", "导航设置", "快速导航设置", "安全设置", "上传设置", "邮箱设置", "友情链接", "内页链接", "广告设置", "管理员设置"],
                        sNavUrl: ["/config.aspx", "/nav.aspx", "/nav1.aspx", "/regex.aspx", "/uploadConfig.aspx", "/email.aspx", "/link.aspx", "/link1.aspx", "/guanggao.aspx", "/admin.aspx"]
                    }, {
                        mUrl: "/config.aspx",
                        sNavName: ["网站设置", "导航设置", "快速导航设置", "安全设置", "上传设置", "邮箱设置", "友情链接", "内页链接", "广告设置", "管理员设置"],
                        sNavUrl: ["/config.aspx", "/nav.aspx", "/nav1.aspx", "/regex.aspx", "/uploadConfig.aspx", "/email.aspx", "/link.aspx", "/link1.aspx", "/guanggao.aspx", "/admin.aspx"]
                    }, {
                        mUrl: "/xxgl.aspx",
                        sNavName: ["信息管理", "发布信息"],
                        sNavUrl: ["/xxgl.aspx", "/post.aspx"]
                    }, {
                        mUrl: "/news.aspx",
                        sNavName: ["文章管理", "发布文章", "文章分类"],
                        sNavUrl: ["/news.aspx", "/newsPost.aspx", "/newsSort.aspx"]
                    }, {
                        mUrl: "/plgl.aspx",
                        sNavName: ["信息评论", "商家评论", "商家留言", "文章评论"],
                        sNavUrl: ["/plgl.aspx", "/biz/review.aspx", "/biz/bizMessage.aspx", "/newspl.aspx"]
                    }, {
                        mUrl: "/sort.aspx",
                        sNavName: ["信息分类", "商家分类", "地区分类", "文章分类"],
                        sNavUrl: ["/sort.aspx", "/bizsort.aspx", "/city.aspx", "/newsSort.aspx"]
                    }, {
                        mUrl: "/token.aspx",
                        sNavName: ["接口设置", "回复管理", "添加回复", "菜单管理", "微信商家会员"],
                        sNavUrl: ["/weixin/token.aspx", "/weixin/weixin.aspx", "/weixin/weixinAdd.aspx", "/weixin/weixinMenu.aspx", "/weixin/weixinMember.aspx"]
                    }];
                    var sMPath = "/adAdd.aspx";
                    var sSPath = "/adAdd.aspx";
                    var sAdminPath = "admin";
                    if (sMPath != "") {
                        q$("nav1").innerHTML = "";
                          for (i = 0; i < objNav.length; i++) {
                          if (objNav[i].mUrl.indexOf(sMPath) != -1) {
                                var sNavStr = "";
                                for (t = 0; t < objNav[i].sNavUrl.length; t++) {
                                    sNavStr += "<li><a href=\"/" + sAdminPath + objNav[i].sNavUrl[t] + "\">" + objNav[i].sNavName[t] + "</a></li>";
                                }
                                q$("nav1").innerHTML = sNavStr;
                            }
                            for (t = 0; t < objNav[i].sNavUrl.length; t++) {
                                if (objNav[i].sNavUrl[t].indexOf(sMPath) != -1) {
                                    sMPath = objNav[i].mUrl;
                                    var sNavStr1 = "";
                                    for (t = 0; t < objNav[i].sNavUrl.length; t++) {
                                        sNavStr1 += "<li><a href=\"/" + sAdminPath + objNav[i].sNavUrl[t] + "\">" + objNav[i].sNavName[t] + "</a></li>";
                                    }
                                    q$("nav1").innerHTML = sNavStr1;
                                }
                            }
                        }
                    }

                    var sAtag = q$("nav").getElementsByTagName("a");
                    for (i = 0; i < sAtag.length; i++) {
                        if (sAtag[i].href.indexOf(sMPath) != -1) {
                            sAtag[i].className = "sto";
                            getElementPos(sAtag[i]).x;
                        }
                    }
                    sAtag = q$("nav1").getElementsByTagName("a");
                    for (i = 0; i < sAtag.length; i++) {
                        if (sAtag[i].href.indexOf(sSPath) != -1) {
                            sAtag[i].className = "sto";
                        }
                    }*/
                </script>
                <div class="d01">
                    <div class="upfileDiv" style="top:217px; left:175px; width:505px;" id="upfileDiv">
                        <div class="upfileClose" onclick="hideDiv('upfileDiv')">关闭</div>
                        <iframe width="300" height="100" style="padding:0px; margin:0px;" src="__CONTROLLER__/uploadform" frameborder="0" scrolling="no"></iframe>
                    </div>
                    <div class="upfileDiv" style="top:217px; left:175px; width:505px;" id="upfileDiv1">
                        <div class="upfileClose" onclick="hideDiv('upfileDiv1')">关闭</div>
                        <iframe width="300" height="100" style="padding:0px; margin:0px;" src="./uploadform.html" frameborder="0" scrolling="no"></iframe>
                    </div>
                    <table width="985" border="0" class="fTable" cellspacing="0" cellpadding="0">
                        <tr>
                            <td colspan="2" class="mhead1">修改广告</td>
                        </tr>
                        <tr>
                            <td class="head" width="150">
                                <strong>广告位</strong></td>
                            <td><strong></strong> 
                                <input type="radio" name="ad_position" <if condition='$data.ad_position eq 中上'> checked=checked </if>"   onclick="setAd1(1)"     value="中上" />中间横幅
                                <input type="radio" name="ad_position" <if condition='$data.ad_position eq 中下'> checked=checked</if>"  onclick="setAd1(2)"  value="中下" />格子展位
                                <input type="radio" name="ad_position" <if condition='$data.ad_position eq 左'> checked=checked</if>"  onclick="setAd1(3)"  value="左" />左对联
                                <input type="radio" name="ad_position" <if condition='$data.ad_position eq 右'> checked=checked</if>"  onclick="setAd1(4)"  value="右" />右对联
                                <br />

                        </tr>
                        <tr>
                            <td class="head" width="100">
                                <strong>类别</strong></td>
                            <td>
                                <input type="radio" name="class" onclick="setAd(this.value)" checked="checked" value="1" />图片
                                <!--备用<input type="radio" name="class" onclick="setAd(this.value)" value="2" />Flash
                                <input type="radio" name="class" onclick="setAd(this.value)" value="3" />代码
                                <input type="radio" name="class" onclick="setAd(this.value)" value="4" />自由编辑</td>-->
                        </tr>
<!--                        <tr id="trsort">
                            <td class="head" width="100">
                                <strong>选择分类</strong>
                                <br /> <a href="__MODULE__/category/index"><font size="2">分类不够?点这增加</font></a>
                            </td>
                            <td>
                                <input name="sort" type="text" value="{$data.cat_name}" onclick="showDiv('msort')" id="sort" class="text01" /><span>{$errorinfo.cat_id}</span>
                                <div style="position:relative; z-index:9999;">
                                    <div class="divEditSort" id="msort" style="left:-50px;">

                                    </div>
                                </div>
                            </td>
                        </tr>-->
                        <tr>
                            <td class="head" width="100"><strong>广告名称</strong></td>
                            <td>
                                <input name="ad_name" id="ad_name" type="text" value="{$data.ad_name}" class="text01" /><span>{$errroinfo.ad_name}</span>
                            </td>
                        </tr>
                        <tr id="pic">
                            <td class="head" width="100">
                                <strong>图片地址</strong></td>
                            <td>
                                <!--暂时不用<input name="waibuurl" id="waibuurl" type="text" value="" class="text01" />--> <a href="#nogo" onclick="showDiv('upfileDiv')">【上传】</a>
                                <strong><font size=2><span id='imgsize'>注意横幅图片宽高最好为960*100</span></font></strong><span>{$errroinfo.ad_img}</span>
                            </td>
                        </tr>
                      <!--备用  <tr id="flash">
                            <td class="head" width="100">
                                <strong>Flash地址</strong></td>
                            <td>
                                <input name="content2" type="text" value="" class="text01" /> <a href="#nogo" onclick="showDiv('upfileDiv1')">【上传】</a>
                            </td>
                        </tr>-->
                        <!--暂时不用
                        <tr id="code">
                            <td class="head" width="100">
                                <strong>代码</strong></td>
                            <td>
                                <textarea name="content3" cols="75" rows="8"></textarea>
                            </td>
                        </tr>
                        <tr id="zybj">
                            <td class="head" width="100">
                                <strong>自由编辑</strong></td>
                            <td>
                                <textarea style="" rows="20" cols="95" name="content4" id="tbContent1"></textarea>
                            </td>
                        </tr>-->
                      <!--暂时不用链接  <tr id="link">
                            <td class="head" width="100"><strong>链接</strong></td>
                            <td>
                                <input name="link" type="text" value="" class="text01" />
                            </td>
                        </tr>-->
                        <tr>
                            <td class="head" width="100">
                                <strong>排序</strong></td>
                            <td>
                                <input name="sort_order" type="text" value="{$data.sort_order}" style="width:330px;" class="text01" /><span>{$errroinfo.sort_order}</span>
                            </td>
                        </tr>
<!--                        <tr>
                            <td class="head" width="100">
                                <strong><a href="javascript:;" onclick="imginfo()">点击增加图片详情(可选)</a></strong></td>
                            <td>
                            </td>
                        </tr>-->
                        <tr class='imgdetail' id='imgdetail1'>
                            <td class="head"  width="100" id='imgdetail1'><strong>大小：</strong></td>
                            <td>宽：
                                <input name="width" type="text" value="" class="text01" style="width:135px;" /> 高：
                                <input name="height" type="text" value="" class="text01" style="width:135px;" />&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                        </tr>
                        <tr class='imgdetail' id='imgdetail2' >
                            <td class="head" width="100"><strong>边距：</strong></td>
                            <td>上：
                                <input name="mt" type="text" value="" class="text01" style="width:50px;" /> 右：
                                <input name="mr" type="text" value="" class="text01" style="width:50px;" /> 下：
                                <input name="mb" type="text" value="" class="text01" style="width:50px;" /> 左：
                                <input name="ml" type="text" value="" class="text01" style="width:50px;" />
                            </td>
                        </tr>
                        <tr>
                            <td class="head" width="100"><strong>日期：</strong></td>
                            <td><!--暂时不要,开始：
                                <input name="startDate" type="text" value="" onFocus="HS_setDate(this)" class="text01" style="width:125px;" />--> 有效期至：
                                <input name="validtime" type="text" value="{$data.ad_overtime}" onFocus="HS_setDate(this)" class="text01" style="width:166px;" />&nbsp;<span>{$errroinfo.validtime}</span>
                            </td>
                        </tr>
<!--以后再说                        <tr id="html">
                            <td class="head" width="100">
                                <strong>广告内容</strong>
                                <br /> （链接不填）设置广告内容后，点击广告会自动转到内容页面
                            </td>
                            <td>
                                <textarea style="" rows="20" cols="95" name="html" id="tbContent"></textarea>
                            </td>
                        </tr>
                        <tr>
                            <td class="head" width="100">
                                <strong>备注</strong></td>
                            <td>
                                <textarea style="" rows="10" cols="50" name="about"></textarea>
                            </td>
                        </tr>-->
                        <tr>
                            <td class="head" width="100"></td>
                            <td><input type="hidden" name='ad_img' id='ad_img' />
                                <input type="hidden" name='cat_id' id='cat_id' value={$data.sort_order}>
                                <input type="submit" class="inputButtomCl" value="确认修改" />
                            </td>
                        </tr>

                    </table>
                </div>
            </div>
        </div>
    </form>
    <script language="javascript" type="text/javascript">
        function changesort(a,b,c) {
            document.getElementById("sort").value = a+">"+b;
            document.getElementById("msort").style.display = "none"
            //隐藏域保存广告所属分类
            $("#cat_id").val(c);
        }

        function showDiv(divId) {
            var data=1;
            $.get(
                '__CONTROLLER__/getCats'
                ,data
                ,function(obj){
                    console.log(obj);
                    var str="<div class=title onclick=changesort('') style=cursor:pointer;>所有分类</div><div class=close onclick=$('#msort').hide();>关闭</div>";
                    for(var i=0,len=obj.length;i<len;i++){
                        str+="<div class=msortt onclick=changesort('房产')>"+obj[i].cat_name+"</div><ul class=ssort>";
                        
                        for(var j=0,lenj=obj[i]['child'].length;j<lenj;j++){
                            str+="<li id='"+obj[i]['child'][j]['cat_id']+"'  onclick=changesort('"+obj[i].cat_name+"','"+obj[i]['child'][j]['cat_name']+"','"+obj[i]['child'][j]['cat_id']+"')>"+obj[i]['child'][j]['cat_name']+"</li>"
                        }
                        str+="</ul><div class=clear></div>";
                    }
                    //将字符串放在div里
                    $("#msort").html(str);
                    
                    
                    
                }   
                ,'json');
            var obj = divId.split(',');
            if (obj.length > 0) {
                for (i = 0; i < obj.length; i++) {
                    document.getElementById(obj[i]).style.display = "block";
                }
            }
        }

        function hideDiv(divId) {
            var obj = divId.split(',');
            if (obj.length > 0) {
                for (i = 0; i < obj.length; i++) {
                    document.getElementById(obj[i]).style.display = "none";
                }
            }
        }

        function setAd(v) {
            $("#flash").hide();
            $("#pic").hide();
            $("#code").hide();
            $("#zybj").hide();
            $("#link").hide();
            $("#html").hide();
            if (v == "1") {
                $("#pic").show();
                $("#link").show();
                $("#html").show();
            }
            if (v == "2") {
                $("#flash").show();
            }
            if (v == "3") {
                $("#code").show();
            }
            if (v == "4") {
                $("#zybj").show();
            }
        }

        function setAd1(v) {
            //console.log($("#content1"));
            if(v==1){
                imgsize.innerHTML="注意横幅图片宽高最好为960*100";
            }
            else if(v==2){
                imgsize.innerHTML="注意格子图片宽高最好为187*75";
            }
            else if(v==3){
                imgsize.innerHTML="注意横幅图片宽高最好为200*600";
            }
            else if(v==4){
                imgsize.innerHTML="注意横幅图片宽高最好为200*600";
            }
            //$("#content1").val('大小');
            //以下注销,
           //$("#trsort").hide();
/*            if (v == "9" || v == "2") {
                $("#trsort").show();
            }*/
        }
        //setTimeout("setAd('1');setAd1('1');", 1000);
        ckRadio("ad", "");
        ckRadio("class", "");
        function imginfo(){
            //$("#imgdetail").toggleClass('imgdetail');
            $("#imgdetail1").toggle();
            $("#imgdetail2").toggle();
        }
        
    </script>
</body>

</html>